<!DOCTYPE html>
<html lang="en" style="background: #F1F1F1 !important;overflow-y: scroll">
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="white">
    <link rel="stylesheet" href="../dist/main.css">

</head>
<body  style="background: #F1F1F1 !important;">



<div id="refreshContainer" class="mui-content mui-scroll-wrapper" style="background: #F1F1F1 !important;">
    <div class="mui-scroll">

        <!--排序导航-->
        <div id="mine" style="padding-bottom:0 !important;">
            <div class="infoBox">
                <div class="mainBox" style="padding-bottom: 0.39rem">
                    <div class="info" >
                        <div class="zs"></div>
                        <div class="noBinding" style="display: none">
                            <p>暂时无法使用跟单系统,</p>
                            <p>请先绑定MT5账号。</p>
                            <div class="btns">
                                <button class="mui-btn mui-btn-warning mui-btn-outlined" id="bidingBtn">绑定MT5账号</button>
                            </div>
                        </div>
                        <div class="hasBinding mainBox" style="display: none;">
                            <div class="mui-row  clearFix">
                                <div class="mui-col-sm-8 mui-col-xs-8" style="padding-top: 0.35rem">
                                    <span id="name">Honor</span>

                                    <br>
                                    <div id="addAutograph">
                                        <span id="addAutographSpan">添加个性签名</span>
                                    </div>
                                    <div class="mt5InfoBox">
                                        <img src="../img/user_time(32_32).png" alt="">
                                        <span id="registerDay">0天</span>
                                    </div>

                                    <div class="mt5InfoBox">
                                        <img src="../img/user_follow(32_32).png" alt="">
                                        <span id="follow">0</span>
                                    </div>
                                    <div class="mt5InfoBox" style="margin-right: 0">
                                        <img src="../img/user_heart(32_32).png" alt="">
                                        <span id="collection">0</span>
                                    </div>

                                </div>
                                <div class="mui-col-sm-4 mui-col-xs-4" style="padding-top: 0.35rem;overflow: hidden"  >
                                    <div class="tx" style="float: right;" id="picker" >

                                    </div>
                                    <div id="heart" style="width: 100%;float: left;text-align: right"></div>
                                </div>

                            </div>


                            <hr>
                            <div class="mui-row  clearFix moreMt5">
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap" >
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            初始资金：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" id="initialMoney">0</span>
                                        </div>
                                    </div>

                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            净利润：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="green" id="profit">$0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            累计入金：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" id="recharge">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            累计盈利：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="green" id="payOff">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            累计出金：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" id="draw">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            累计亏损：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="green" id="loss">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            累计库存费：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" >0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            当前余额：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="green" id="initBalance">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            累计手续费：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" id="commission">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            信用额度：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" id="credit">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="mui-col-sm-6 mui-col-xs-6 wrap">
                                    <div class="mui-row  clearFix">
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            跟单资金：
                                        </div>
                                        <div class="mui-col-sm-6 mui-col-xs-6">
                                            <span class="gray" id="documentaryFunds">0</span>
                                        </div>
                                    </div>
                                </div>


                            </div>


                            <div id="btns" style="padding-bottom: 0.4rem">

                            </div>


                        </div>

                    </div>



                </div>
            </div>
            <!--查看大牛-->
            <div id="historyChiWrap" class="clearFix">
                <div class="mainBox" style="padding-bottom: 0;padding-top: 0">
                    <ul class="clearFix" style="padding-left: 0">
                        <li class="hasBorder oChoose">当前持仓</li>
                        <li class="oChoose">历史订单</li>
                    </ul>
                </div>

            </div>


        </div>
        <!--筛选-->
   <div id="chi" style="margin-top: -0.22rem;">


        <!--数据列表-->
        <ul class="mui-table-view" id="mui-table-view" >

        </ul>
       <ul class="mui-table-view" id="mui-table-view2" style="display: none">

       </ul>
        <div id="noDatas2" style="display: none" class="noDatas">
            <img src="../img/warnNoOrders(310_240).png" alt="">
            <p>暂无历史订单</p>
            <div class="btns" style="display: none">
                <button class="mui-btn mui-btn-warning mui-btn-outlined" id="bidingBtn">绑定MT5账号</button>
            </div>
        </div>


    </div>
    </div>
</div>


<view></view>

</body>
</html>
<script src="../dist/main.js"></script>
<script src="../dist/layui.js"></script>

<script>

    $("title").html(mt5Obj.title)
    var chiBol=true;
    var postDatas={
        limit:10,
        offset:0,
        onlineMtLogin:sessionStorage.getItem("sourceLogin")
    };
    (function () {
        bolBinding()
        if( sessionStorage.getItem("bolBindingMT5")=="false"){
            $(".noBinding").show()
        }else{
            $(".hasBinding").show()

        }
        $("#companyEmail").html(mt5Obj.companyEmail);


        if(sessionStorage.getItem("type")=="0"){
            $(".mower").show();

        }else{
            $(".follower").show();

        }

    })();
    //个人信息
    function  info() {
        $("#btns button").remove()
        $("#heart img").remove()
        var collection;
        var bolFollow;
        $.ajax({
            url:mt5Obj.allUrl+"users/otherSeeSource",
            data:{
                login:sessionStorage.getItem("sourceLogin")
            },
            success:function (data) {
                for(x in data.data){
                    infoGe(x,data.data[x])

                }
                if(data.data.icon){
                    $("#picker").css("background","url("+data.data.icon+")")
                    $("#picker").css("backgroundSize","cover")
                }
                if(data.data.myCollection ==0){

                    collection='<img src="../img/heartFull(40_40).png" alt=""  type="1" class="getHeart">';
                }else{
                    collection='<img src="../img/heartEmpty(40_40).png" alt="" class="getHeart"  type="0">'
                }
                if(sessionStorage.getItem("type")=="1"){
                    if(data.data.follows ==0){
                        bolFollow='<button class="hasGen genBtn canselButton" style="box-shadow: 0rem 0.01rem 0.13rem 0rem #ffaa05; color: #ffaa05;margin-top: -0.07rem">更改设置</button>'
                    }else{
                        bolFollow='<button class="genBtn sureButton" style="margin-top: -0.07rem">立即跟单</button>'

                    }

                }

                $("#btns").append(bolFollow)
                $("#heart").append(collection)
                if(data.data.explain){
                    $("#addAutographSpan").html(data.data.explain)

                }
                console.log(data.data.icon)


            }
        })

    }

//收藏
    mui("body").on('tap','.getHeart',function(){
        var type=$(this).attr("type");
        var login=sessionStorage.getItem("sourceLogin");

        $.ajax({
            url:mt5Obj.allUrl+"collection/collections",
            type:"post",
            data:{
                sourceLogin:login,
                type:type,
            },
            success:function (data) {
                $("#mowList .hasboder").remove();
                if(data.data){
                    if(type==0){
                        mui.toast("收藏成功");
                    }else{
                        mui.toast("取消收藏成功")
                    }


                }
                info()
            }
        })


    })
    //跟单
    mui("body").on('tap','.genBtn',function(){

        if(sessionStorage.getItem("bolBindingMT5")=="false"){
            noBinding()
        }else{
            if( $(this).hasClass("hasGen")) {
                goUrl("genSet","10")
            }else{
                goUrl("genSet","11")
            }
        }


    })
    function chiList(down) {
        var str = "";
        var icon="";
        var oImg="";
        var profitAndLoss="";
        var finalProfit="";
        $.ajax({
            url: mt5Obj.allUrl + "users/otherOrder",
            data:postDatas,
            success: function (data) {
                if(data.error){
                    if(data.error.code==1003111133){
                        $("#noDatas").show();
                        $("#noDatas .btns").show();


                    }
                }else {
                    if(data.total==0){
                        $("#noDatas2").show();
                    }else{
                        $("#noDatas2").hide();
                    }
                }
                if (data.rows) {
                    $("#refreshContainer").show();
                    mui('#refreshContainer').pullRefresh().endPulldownToRefresh();
                    noMore(down,data);
                    for(x in data.rows){

                        if (data.rows[x].icon){
                            icon=data.rows[x].icon
                        }else {
                            icon="../img/signalHead(120_120).png"
                        }

                        if (data.rows[x].action==1){
                            oImg="../img/labelSell(40_40).png"
                        }else {
                            oImg="../img/labelBuy(40_40).png"
                        }

                        if(data.total==0){
                            $("#noDatas").show();
                        }else{
                            $("#noDatas").hide();
                        }

                        if(data.rows[x].profitAndLoss>=0){
                            profitAndLoss="+$"+data.rows[x].profitAndLoss.toLocaleString()
                            finalProfit='<span class="right green">'+profitAndLoss+'</span>';
                        }else{
                            profitAndLoss="-$"+data.rows[x].profitAndLoss.toString().split("-")[1].toLocaleString()
                            finalProfit='<span class="right red">'+profitAndLoss+'</span>';
                        }


                        str = ' <li class="mui-table-view-cell mui-collapse">' +
                            '                    <a class="mui-navigate-right" href="#">'+data.rows[x].order+'</a>' +
                            '                    <div class="showContent">' +
                            '                        <div class="mainBox">' +
                            '                            <div class="mui-content">' +
                            '                                <div class="mui-row clearFix">' +
                            '                                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                                    <div  class="chiTx" style="background:url('+icon +' );background-size: cover"></div>' +
                            '                                    <span>'+data.rows[x].sourceName+'</span>' +
                            '                                </div>' +
                            '                                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                                    浮动盈亏：' +
                            finalProfit +
                            '                                </div>' +
                            '                            </div>' +
                            '                                <div class="mui-row clearFix">' +
                            '                                    <div class="mui-col-sm-6 mui-col-xs-6">' +
                            data.rows[x].symbol +
                            '                                    <img src="'+oImg+'" alt="" class="duo">' +
                            '                                    </div>' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    交易量:' +
                            '                    <span class="right yellow">'+data.rows[x].shoushu+'手</span>' +
                            '                </div>' +

                            '                                </div>' +
                            '                   </div>' +
                            '             </div>' +
                            '<div class="mui-collapse-content">' +
                            '        <div class="mui-content">' +
                            '            <div class="mui-row clearFix">' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    开仓价格：' +
                            '                    <span class="gray">'+data.rows[x].openPrice +'</span>' +
                            '                </div>' +
                            '                                    <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                                        止盈：' +
                            '                                        <span class="right gray">'+data.rows[x].tp+'</span>' +
                            '                                    </div>' +

                            '            </div>' +
                            '            <div class="mui-row clearFix">' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    <span style="float: left">开仓时间：</span>' +
                            '                    <span class="gray" style="float: left">'+data.rows[x].openTime+'</span>' +
                            '                </div>' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    止损：' +
                            '                    <span class="right gray">'+data.rows[x].sl+'</span>' +
                            '                </div>' +
                            '            </div>' +
                            '        </div>' +
                            '</div>' +
                            '</li>';

                        $("#mui-table-view").append(str)
                    }


                }



            }
        })
    }

    //    上拉刷新配置
    refreshApp();
    //下拉刷新
    function  refrecha() {
        $("#mui-table-view li").remove();
        $("#mui-table-view2 li").remove();
        postDatas.offset=0;
        self=this;
        if (chiBol){
            chiList("down")
        }else{
            historyList("down")
        }

        info()
    }

    //    上拉加载
    function loadMore() {
        var offset=postDatas.offset
        self=this
        postDatas.offset=postDatas.offset+=10;
        if (chiBol){
            chiList()
        }else{
            historyList()
        }


    }
//    筛选
    mui("body").on('tap','.oChoose',function(){
        $("#mui-table-view li").remove();
        $("#mui-table-view2 li").remove();
             $(this).toggleClass("hasBorder")
             $(this).siblings().removeClass("hasBorder");
             if($(this).html()=="当前持仓"){
                 $("#mui-table-view2").hide();
                 $("#mui-table-view").show()
                 postDatas.offset=0;
                 chiList("down")
                 chiBol=true;


             }else{
                 $("#mui-table-view").hide();
                 $("#mui-table-view2").show();
                 postDatas.offset=0;
                 chiBol=false;
                 historyList("down")
             }
    })

//    历史记录
    function historyList(down) {
        var str = "";
        var icon="";
        var oImg="";
        var profit="";
        var finalProfit="";
        $.ajax({
            url: mt5Obj.allUrl + "mt/user/coverOrder",
            data:postDatas,
            success: function (data) {
                if(data.error){
                    if(data.error.code==1003111133){
                        $("#noDatas").show();
                        $("#noDatas .btns").show();


                    }
                }else {
                    if(data.total==0){
                        $("#noDatas2").show();
                    }else{
                        $("#noDatas2").hide();
                    }
                }

                if (data.rows) {
                    $("#refreshContainer").show();

                    mui('#refreshContainer').pullRefresh().endPulldownToRefresh();
                    noMore(down,data);
                    for(x in data.rows){

                        if (data.rows[x].sourceIcon){
                            icon=data.rows[x].sourceIcon
                        }else {
                            icon="../img/signalHead(120_120).png"
                        }

                        if (data.rows[x].action==1){
                            oImg="../img/labelSell(40_40).png"
                        }else {
                            oImg="../img/labelBuy(40_40).png"
                        }

                        if(data.rows[x].profit>=0){
                            profit="+$"+data.rows[x].profit.toLocaleString()
                            finalProfit= '<span class="right green">'+profit+'</span>'
                        }else{
                            profit="-$"+data.rows[x].profit.toString().split("-")[1].toLocaleString()
                            finalProfit= '<span class="right red">'+profit+'</span>'
                        }



                        str = ' <li class="mui-table-view-cell mui-collapse">' +
                            '                    <a class="mui-navigate-right" href="#">'+data.rows[x].order+'</a>' +
                            '                    <div class="showContent">' +
                            '                        <div class="mainBox">' +
                            '                            <div class="mui-content">' +
                            '                                <div class="mui-row clearFix">' +
                            '                                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                                    <div  class="chiTx" style="background:url('+icon +' );background-size: cover"></div>' +
                            '                                    <span>'+data.rows[x].sourceName+'</span>' +
                            '                                </div>' +
                            '                                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                                    平仓盈亏：' +
                            finalProfit +
                            '                                </div>' +
                            '                            </div>' +
                            '                                <div class="mui-row clearFix">' +
                            '                                    <div class="mui-col-sm-6 mui-col-xs-6">' +
                            data.rows[x].symbol +
                            '                                    <img src="'+oImg+'" alt="" class="duo">' +
                            '                                    </div>' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    交易量:' +
                            '                    <span class="right yellow">'+data.rows[x].shoushu+'手</span>' +
                            '                </div>' +

                            '                                </div>' +
                            '                   </div>' +
                            '             </div>' +
                            '<div class="mui-collapse-content">' +
                            '        <div class="mui-content">' +
                            '            <div class="mui-row clearFix">' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    开仓价格：' +
                            '                    <span class="gray">'+data.rows[x].openPrice +'</span>' +
                            '                </div>' +
                            '                                    <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                                        止盈：' +
                            '                                        <span class="right gray">'+data.rows[x].tp+'</span>' +
                            '                                    </div>' +

                            '            </div>' +
                            '            <div class="mui-row clearFix">' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    <span>开仓时间：</span>' +
                            '                    <span class="gray">'+data.rows[x].openTime+'</span>' +
                            '                </div>' +
                            '                <div class="mui-col-sm-6 mui-col-xs-6">' +
                            '                    止损：' +
                            '                    <span class="right gray">'+data.rows[x].sl+'</span>' +
                            '                </div>' +
                            '            </div>' +
                            '        </div>' +
                            '            <div class="mui-row clearFix">' +
                            '                <div class="mui-col-sm-12 mui-col-xs-12">' +
                            '                    <span>平仓价格：</span>' +
                            '                    <span class="gray">'+data.rows[x].closePrice+'</span>' +
                            '                </div>' +
                            '                <div class="mui-col-sm-12 mui-col-xs-12">' +
                            '                    平仓时间：' +
                            '                    <span class="gray">'+data.rows[x].closeTime
                            +'</span>' +
                            '                </div>' +
                            '            </div>' +
                            '        </div>' +
                            '</div>' +
                            '</li>';

                        $("#mui-table-view2").append(str)
                    }


                }



            }
        })
    }


</script>




